package org.example.apifallback.util;

/**
 * @author zengxiaoyu
 * @date 2025/7/31 16:10
 */
public class StrFormatter {
    public static String format(String template, Object... args) {
        StringBuilder stringBuilder = new StringBuilder();
        if(template.contains("{}")){
            String[] arr = template.split("\\{}");
            for(int i = 0; i < arr.length; i++){
                stringBuilder.append(arr[i]);
                if(i < args.length){
                    stringBuilder.append(args[i]);
                }
            }
            return stringBuilder.toString();
        }
        return template;
    }
}
